1. Technical Field of the Invention
The present invention relates to a geomagnetic field measurement device, an offset determination method therefor, and a computer-readable recording medium having recorded thereon a computer program for executing the method.
2. Description of Related Art
A three-dimensional magnetic sensor mounted in a portable device such as a mobile phone or a moving body such as an automobile has been recently developed for measuring a geomagnetic field. In general, a three-dimensional magnetic sensor has three magnetic sensor modules for decomposing a vector of a magnetic field into components in three directions to measure scalar quantities thereof, and outputs three-dimensional vector data having, as three components, scalar quantities output respectively by the three magnetic sensor modules.
A device such as a mobile phone in which a three-dimensional magnetic sensor is mounted often contains parts such as various magnetic metals and electric circuits, which generate magnetic fields. In this case, vector data output by the three-dimensional magnetic sensor will be a value that includes a vector representing a magnetic field such as an internal magnetic field, i.e., a magnetic field generated by parts mounted in the device in addition to a vector representing a geomagnetic field. Therefore, to accurately obtain the value of a geomagnetic field, a correction process is required to remove the vector representing the internal magnetic field from the vector data output from the three-dimensional magnetic sensor.
In the correction process, a value of disturbance to be removed from data output from a three-dimensional magnetic sensor is called an offset, and this offset is used to obtain an accurate value of a geomagnetic field to be measured.
The internal magnetic field is a magnetic field that has a nearly constant direction relative to a device and has a nearly constant magnitude. Such an internal magnetic field, when viewed from a three-dimensional magnetic sensor mounted in a device, is expressed as a vector having a nearly constant direction and a nearly constant magnitude no matter how the orientation of the device is changed.
On the other hand, the geomagnetic field is a magnetic field that has a horizontal component pointing to the magnetic north pole and a vertical component in a magnetic dip (elevation angle) direction, and is a uniform magnetic field that has a nearly constant direction relative to the ground and a nearly constant magnitude. Therefore, in a case in which the orientation of a device is changed relative to the ground, the direction of a geomagnetic field viewed from the device also changes. That is, when viewed from a three-dimensional magnetic sensor mounted in a device, a geomagnetic field is expressed as a vector that changes direction along with changes in the orientation of the device but that has a nearly constant magnitude.
Using such properties of a geomagnetic field and an internal magnetic field, it is possible to divide output data from a three-dimensional magnetic sensor into a component representing the internal magnetic field that has nearly constant direction and magnitude when viewed from the magnetic sensor and a component representing the geomagnetic field of which the magnitude is nearly constant but of which the direction changes along with changes in the orientation of the three-dimensional magnetic sensor. Then, an accurate value of the geomagnetic field can be obtained by removing from the output data a vector as an offset having a component representing this internal magnetic field.
Japanese Patent Application Laid-Open Publication 2007-240270 describes a method of calculating an accurate offset by using plural pieces of magnetic data output from a three-dimensional magnetic sensor.
In a case in which there is an object such as a speaker or a personal computer that generates a magnetic field near a device such as a mobile phone in which a three-dimensional magnetic sensor is mounted, the three-dimensional magnetic sensor measures not only the above-described geomagnetic field and internal magnetic field, but also an external magnetic field generated by the object outside the device. Generally, an external magnetic field is a non-uniform magnetic field that changes its direction and magnitude depending on a relative positional relationship between an object, outside a device, that generates the external magnetic field, and a three-dimensional magnetic sensor mounted in the device, etc.
However, conventionally, it was not possible to determine whether such a non-uniform external magnetic field exists or what degree of effect is caused by the existence of such a non-uniform external magnetic field. Therefore, in the conventional method, there was a disadvantage that, even if a vector of an internal magnetic field calculated in an environment in which a non-uniform external magnetic field exists has a large error, a value of the vector is determined as a correct value that is calculated in an environment with no external magnetic field, resulting in the value of the vector including the large error sometimes being employed as an offset.
Similarly, there was a disadvantage that an offset sometimes includes a large error in a case in which a two-dimensional magnetic sensor outputs two-dimensional vector data having, as the two components, scalar quantities output by each of two magnetic sensor modules provided therein, which two magnetic sensor modules decompose a vector of a magnetic field into two components of two mutually orthogonal directions to measure scalar quantities.